package com.shop.pojo;

import com.baomidou.mybatisplus.annotation.*;
import org.springframework.beans.BeanUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import lombok.ToString;

/**
 * 订单状态表;订单的每个状态更改都需要进行记录
10：待付款  20：已付款，待发货  30：已发货，待收货（7天自动确认）  40：交易成功（此时可以评价）50：交易关闭（待付款时，用户取消 或 长时间未付款，系统识别后自动关闭）
退货/退货，此分支流程不做，所以不加入
 * 
 * @author yukangkang
 * @email sunlightcs@gmail.com
 * @date 2020-10-30 13:16:29
 */
@Data
@ToString
@TableName("order_status")
public class OrderStatus implements Serializable {
	private static final long serialVersionUID = 1L;

		/**
		 * 订单ID;对应订单表的主键id
		 */
		@TableId(value = ORDER_ID)
		private String orderId;
		/**
		 * 订单状态
		 */
		@TableField(ORDER_STATUS)
		private Integer orderStatus;
		/**
		 * 订单创建时间;对应[10:待付款]状态
		 */
		@TableField(value = CREATED_TIME,fill = FieldFill.INSERT)
		private Date createdTime;
		/**
		 * 支付成功时间;对应[20:已付款，待发货]状态
		 */
		@TableField(PAY_TIME)
		private Date payTime;
		/**
		 * 发货时间;对应[30：已发货，待收货]状态
		 */
		@TableField(DELIVER_TIME)
		private Date deliverTime;
		/**
		 * 交易成功时间;对应[40：交易成功]状态
		 */
		@TableField(SUCCESS_TIME)
		private Date successTime;
		/**
		 * 交易关闭时间;对应[50：交易关闭]状态
		 */
		@TableField(CLOSE_TIME)
		private Date closeTime;
		/**
		 * 留言时间;用户在交易成功后的留言时间
		 */
		@TableField(COMMENT_TIME)
		private Date commentTime;




	public final static String ORDER_ID =  "`order_id`";
	public final static String ORDER_STATUS =  "`order_status`";
	public final static String CREATED_TIME =  "`created_time`";
	public final static String PAY_TIME =  "`pay_time`";
	public final static String DELIVER_TIME =  "`deliver_time`";
	public final static String SUCCESS_TIME =  "`success_time`";
	public final static String CLOSE_TIME =  "`close_time`";
	public final static String COMMENT_TIME =  "`comment_time`";


	public final static String ORDER_ID_COMMENT =  "订单ID;对应订单表的主键id";
	public final static String ORDER_STATUS_COMMENT =  "订单状态";
	public final static String CREATED_TIME_COMMENT =  "订单创建时间;对应[10:待付款]状态";
	public final static String PAY_TIME_COMMENT =  "支付成功时间;对应[20:已付款，待发货]状态";
	public final static String DELIVER_TIME_COMMENT =  "发货时间;对应[30：已发货，待收货]状态";
	public final static String SUCCESS_TIME_COMMENT =  "交易成功时间;对应[40：交易成功]状态";
	public final static String CLOSE_TIME_COMMENT =  "交易关闭时间;对应[50：交易关闭]状态";
	public final static String COMMENT_TIME_COMMENT =  "留言时间;用户在交易成功后的留言时间";


	public static OrderStatus of(Object obj) {
		OrderStatus e = new OrderStatus();
		BeanUtils.copyProperties(obj, e);
		return e;
	}

	public static QueryWrapper<OrderStatus> queryWrapper(Object obj) {
		return new QueryWrapper<>(of(obj));
	}



}
